﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace University_students
{
    class Grops
    {
        public string gropeNumber;

        public List<Students> studentsList = new List<Students>();
        //List<Students> StudentCollection = new List<Students>();
        //StudentCollection.Add(tempStudent);
        public void AddStudentsToGrope()
        {
            
            string choice = "";
            do
            {
                Console.WriteLine("Would you like to add students to the grope? Y/N");
                choice = Console.ReadLine();
                if (choice == "Y")
                {
                   
                    Students newStudent = new Students();
                    newStudent.AddStudentsInfo();
                    newStudent.AllMarks();
                    newStudent.avarageOfAllMarks();
                    studentsList.Add(newStudent);
                }
            } while (choice == "Y");
            
        }

        public void GropeNumberAdding()
        {
            Console.WriteLine("Enter the grope number: ");
            gropeNumber = Console.ReadLine();
        }
 

    public void GropeInfo()
        {
            Console.WriteLine("Grope - {0}", gropeNumber);
        }

        public void PrintStudentDisplay()
        {
            foreach (var singleStudent in studentsList)
            {
                singleStudent.StudentInfo();
            }
        }

        public void PrintStudentInfoWithPercentOfAchievementMoreEqual(double choicePercent)
        {
            
            foreach (var singleStudent in studentsList)
            {
                bool isStudentExist = false;
                if (singleStudent.avarageOfAllMarks() >= choicePercent)
                {
                    singleStudent.StudentInfo();
                }
                if (!isStudentExist)
                {
                    Console.WriteLine("There is no students with such achievements.");
                }
            }
        }

        public void PrintStudentInfoWithPercentOfAchievementLessEqual(double choicePercent)
        {
            Students tempStudent = new Students();
            
            foreach (var singleStudent in studentsList)
            {
                bool isStudentExist = false;
                if (singleStudent.avarageOfAllMarks() <= choicePercent)
                {
                    singleStudent.StudentInfo();
                    isStudentExist = true;
                }
                if (!isStudentExist)
                {
                    Console.WriteLine("There is no students with such achievements.");
                }
            }
        }

    }
}
